package org.huang.spock.spring.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.huang.spock.spring.bo.Person;

import java.util.List;

@Mapper
public interface PersonAnnoMapper {

    @Select("select * from t_person where dept_id = #{deptId}")
    List<Person> listByDeptId(Integer deptId);

    @Select("select * from t_person where id = #{id} limit 1")
    Person getById(Integer id);

    @Select({"<script>",
            "select * from t_person where id in",
            "<foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach>",
            "</script>"})
    List<Person> listByIds(@Param("ids") List<Integer> ids);
}
